package com.dff.jrfw;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.dff.jrfw.databinding.ActivityVersionBinding;

import java.text.MessageFormat;

public class VersionActivity extends BaseActivity {

    public static void callMe(Context context) {
        context.startActivity(new Intent(context, VersionActivity.class));
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityVersionBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_version);
        try {
            binding.version.setText(MessageFormat.format("Version{0}", getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        binding.ivBack.setOnClickListener(v -> finish());
    }
}
